home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Light ROM Gold
/
Light ROM Gold.iso
/
arexx
/
modeler
/
particle.rex
< prev
next >
Wrap
OS/2 REXX Batch file
|
1995-03-23
|
2KB
|
73 lines
/* CMD: Points to Particles
*
* Converts all points into single-point polygons with the default surface.
* Creates new particles in an empty layer if there is one. Currently uses
* all points in the layer, but could be restricted to selected points by
* setting selection mode to USER.
*
* 6/93 Stuart Ferguson
*/
mxx="LWModelerARexx.port"
signal on error
signal on syntax
mxx_add = addlib(mxx,0)
call main
if (mxx_add) then call remlib(mxx)
exit
syntax:
error:
t=Notify(1,'!Rexx Script Error','@'ErrorText(rc),'Line 'SIGL)
if (mxx_add) then call remlib(mxx)
exit
main:
syscode = "Particles"
tmpnam = "t:particles.tmp"
/* Use xfrm mode to scan through points, storing coordinates to tmp file.
*/
if (~open(plist, tmpnam, 'W')) then return
n = xfrm_begin()
if (n = 0) then do
call close(plist)
return
end
call meter_begin(n, syscode, "Reading Points")
do i=1 to n
call writeln(plist, xfrm_getpos(i))
call meter_step()
end i
call meter_end()
call xfrm_end()
call close(plist)
/* Goto an empty layer. If none, replace current data.
*/
emp = emptylayers()
if (words(emp) = 0) then call delete()
else call setlayer(word(emp,1))
/* Read the point coordinates back in and create new data consisting
* of single-point polygons.
*/
if (~open(plist, tmpnam, 'R')) then return
call add_begin()
call meter_begin(n, syscode, "Generating Particles")
do i=1 to n
call add_polygon add_point(readln(plist))
call meter_step()
end i
call meter_end()
call add_end()
return